#ifndef _TBTHREAD_H_
#define _TBTHREAD_H_

#include "TBSettings.h"

#include <wtypes.h>

namespace tb
{

	class TB_DLL_FUNC Thread 
	{

	public:

		enum RunPriority
		{
			eRunPriority_Idle      = THREAD_PRIORITY_IDLE,
			eRunPriority_Lowest    = THREAD_PRIORITY_LOWEST,
			eRunPriority_Low       = THREAD_PRIORITY_BELOW_NORMAL,
			eRunPriority_Normal	   = THREAD_PRIORITY_NORMAL,
			eRunPriority_High      = THREAD_PRIORITY_ABOVE_NORMAL,
			eRunPriority_Highest   = THREAD_PRIORITY_HIGHEST,
			eRunPriority_Critical  = THREAD_PRIORITY_TIME_CRITICAL
		};

		Thread();
		virtual ~Thread();

		inline HANDLE GetHandle() { return m_Thread; }

		void Start();
		void Stop();
		void Wait(long a_MilliSeconds);
		void Suspend();
		void Resume();
		void Kill();

		virtual void Run() { }

		void SetPriority(RunPriority a_Priority);
		inline RunPriority GetPriority() { return m_Priority; }

	protected:

		RunPriority m_Priority;
		HANDLE m_Thread;

	}; // class Thread

}; // namespace tb

#endif